Skip to content

Conversation

@nkomonen-amazon
Copy link
Contributor

Problem:

In our development build we spawn a webpack server that serves the Vue files used by our webviews. It is served on port 8080, but sometimes an existing process is already using it, and this causes the webpack server to use the next available port. But because we assume it will use 8080 it silently breaks, and when developing the Q webview would not load as expected.

Solution:

Explicitly require 8080 in the webpack server cli command, also create a custom script to catch the error early and explain how to resolve it.

Now in the build tasks if 8080 is in use the dev can see the failed task with the solution explicitly stated.


  • Treat all work as PUBLIC. Private feature/x branches will not be squash-merged at release time.
  • Your code changes must meet the guidelines in CONTRIBUTING.md.
  • License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

Problem:

In our development build we spawn a webpack server that serves the Vue files
used by our webviews. It is served on port 8080, but sometimes an existing
process is already using it, and this causes the webpack server to use the next
available port. But because we assume it will use 8080 it silently breaks.

Solution:

Explicitly require 8080 in the webpack server cli command, also create a custom
script to catch the error early and explain how to resolve it.

Signed-off-by: nkomonen-amazon <[email protected]>
@nkomonen-amazon nkomonen-amazon requested a review from a team as a code owner February 11, 2025 17:00
@github-actions
Copy link

  • This pull request implements a feat or fix, so it must include a changelog entry (unless the fix is for an unreleased feature). Review the changelog guidelines.
    • Note: beta or "experiment" features that have active users should announce fixes in the changelog.
    • If this is not a feature or fix, use an appropriate type from the title guidelines. For example, telemetry-only changes should use the telemetry type.

"cwd": "${workspaceFolder}/../../packages/core"
}
},
"presentation": { "panel": "dedicated" }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This solved the following issue:

  • The webpack serve command would fail
  • A subsequent build task would reuse this terminal since it failed
  • The reuse caused the port in use error message to be hidden

Now the webpack serve command is in a dedicated terminal that does not disappear, so it is more obvious when it breaks.

"compileDev": "npm run compile -- --mode development",
"webpackDev": "webpack --mode development",
"serveVue": "webpack serve --config-name vue --mode development",
"serveVue": "ts-node ./scripts/build/checkServerPort.ts && webpack serve --port 8080 --config-name vue --mode development",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the explicitness just to make it easy to identify that the webpack port and the port in checkServerPort are easy?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the explicit --port 8080 is a fallback in case something breaks in the script, but isn't explicitly needed. Also by default webpack serve will use 8080, so I thought it would just help make that more obvious.

@nkomonen-amazon nkomonen-amazon merged commit 3f45c37 into aws:master Feb 11, 2025
22 of 26 checks passed
@nkomonen-amazon nkomonen-amazon deleted the webpackServeFix branch February 11, 2025 20:55
s7ab059789 pushed a commit to s7ab059789/aws-toolkit-vscode that referenced this pull request Feb 19, 2025
)

## Problem:

In our development build we spawn a webpack server that serves the Vue
files used by our webviews. It is served on port 8080, but sometimes an
existing process is already using it, and this causes the webpack server
to use the next available port. But because we assume it will use 8080
it silently breaks, and when developing the Q webview would not load as
expected.

## Solution:

Explicitly require 8080 in the webpack server cli command, also create a
custom script to catch the error early and explain how to resolve it.

Now in the build tasks if 8080 is in use the dev can see the failed task
with the solution explicitly stated.

---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.

Signed-off-by: nkomonen-amazon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants